package com.scs.application.modules.volant.util;
public class StringUtil {
    /**
     * 驼峰转下划线
     *
     * @param strField 实体类字段，示例：officeCode
     * @return 返回数据库字段格式，示例：office_code
     */
    public static String humpToUnderline(String strField) throws Exception {
        StringBuilder sb = new StringBuilder();
        char[] chars = strField.toCharArray();
        for (char c : chars) {
            if (c >= 65 && c <= 90) {
                c += 32;
                sb.append("_");
            }
            sb.append(c);
        }
        return sb.toString();
    }
}
